<!DOCTYPE html>
<html>
<head>
    <title>采购申报</title>
    {% include 'system/common/header.html' %}</head>
<body class="pear-container">
<div class="layui-card">
    <form class="layui-form layui-form-pane" action="">
        <div class="layui-form-item">
            <label class="layui-form-label">设备名称</label>
            <div class="layui-input-block">
                <input type="text" name="deviceName" autocomplete="off" placeholder="请输入" lay-verify="required"
                       class="layui-input">
            </div>
        </div>
        <div class="layui-form-item">
            <label class="layui-form-label">设备型号</label>
            <div class="layui-input-block">
                <input type="text" name="typeNum" autocomplete="off" placeholder="请输入" lay-verify="required"
                       class="layui-input">
            </div>
        </div>
        <div class="layui-form-item">
            <label class="layui-form-label">生产厂家</label>
            <div class="layui-input-block">
                <input type="text" name="producer" autocomplete="off" placeholder="请输入" lay-verify="required"
                       class="layui-input">
            </div>
        </div>
        <div class="layui-form-item">
            <label class="layui-form-label">保修信息</label>
            <div class="layui-input-block">
                <input type="text" name="warranty" autocomplete="off" placeholder="请输入" lay-verify="required"
                       class="layui-input">
            </div>
        </div>
        <div class="layui-form-item">
            <div class="layui-inline">
                <label class="layui-form-label">金额范围</label>
                <div class="layui-input-inline" style="width: 100px;">
                    <div class="layui-input-group">
                        <input type="text" name="min_money" lay-verify="required" autocomplete="off"
                               placeholder="￥"
                               class="layui-input">
                        <div class="layui-input-suffix">
                            元
                        </div>
                    </div>
                </div>
                <div class="layui-form-mid">-</div>
                <div class="layui-input-inline" style="width: 100px;">
                    <div class="layui-input-group">
                        <input type="text" name="max_money" lay-verify="required" autocomplete="off"
                               placeholder="￥"
                               class="layui-input">
                        <div class="layui-input-suffix">
                            元
                        </div>
                    </div>
                </div>
            </div>
        </div>

        <div class="layui-form-item layui-form-text">
            <label class="layui-form-label">详细说明</label>
            <div class="layui-input-block">
                <textarea placeholder="请输入内容" class="layui-textarea"></textarea>
            </div>
        </div>
        <div class="layui-form-item">
            <button class="layui-btn" lay-submit lay-filter="submit">确认</button>
            <button type="reset" class="layui-btn layui-btn-primary">重置</button>
        </div>
    </form>
</div>
</body>


{% include 'system/common/footer.html' %}
<script>
    layui.use(['form', 'table'], function () {
        let form = layui.form

        let $ = layui.$;

        form.on('submit(submit)', function (data) {
            event.preventDefault();
            let cData = JSON.stringify(data.field);
            console.log(cData)
            $.ajax({
                url: '/system/approve/buy/submit',
                data: cData,
                dataType: 'json',
                contentType: 'application/json',
                type: 'post',
                success: function (result) {
                    if (result.success) {
                        layer.msg(result.msg, {icon: 1, time: 1000}, function () {
                            location.reload();
                        })
                    } else {
                        layer.msg(result.msg, {icon: 2, time: 1000});
                    }
                }
            })
        })
    });
</script>
</html>